local skill = fk.CreateSkill{
  name = "tea__kouhuo&",
}
local U = require "packages/utility/utility"
---@type ViewAsSkillSpec
local kouhuo_viewas = {
  mute = true,
  pattern = "slash",
  prompt = "#tea__kouhuo_viewas-invoke",
  interaction = function(self, player)
    local all_names = {"slash"}
    local names = player:getViewAsCardNames("tea__kouhuo&", all_names, player:getCardIds("he"))
    if #names > 0 then
      return UI.CardNameBox { choices = names, all_choices = all_names }
    end
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and self.interaction.data
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 or not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card:addSubcards(cards)
    card.skillName = skill.name
    return card
  end,
  before_use = function(self, player, use)
    if not use.extra_data then
      use.extra_data = {}
    end
    use.extra_data.tea__kouhuo_slash = true
    player.room:notifySkillInvoked(player, skill.name, "special")
    player:broadcastSkillInvoke("tea__kouhuo", 1)
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(skill.name, Player.HistoryTurn) == 0
  end,
  enabled_at_response = function(self, player, response)
    return not response and player:usedSkillTimes(skill.name, Player.HistoryTurn) == 0
  end,
}
skill:addEffect("viewas", kouhuo_viewas)
return skill